package com.jt.system.controller;

import com.jt.system.pojo.User;
import com.jt.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/login/{username}")
    public User selectUserByName(@PathVariable("username") String username){
        return userService.selectUserByName(username);
    }

    /**
     * 根据用户ID查询用户权限，后续还会再sso-auto中进行远程调用
     * @param userId
     * @return
     */
    @GetMapping("/permission/{userId}")
    public List<String> selectUserPermissions(@PathVariable("userId") Long userId){
        return userService.selectUserPermission(userId);
    }
}
